package action;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {
	//ApplicationContext act=new ClassPathXmlApplicationContext("bean1.xml");
	
	protected  HttpServletRequest request;
	protected HttpServletResponse response;
	protected HttpSession session;
	protected ServletContext application;

	
	
	public BaseAction() {
		super();
		request = ServletActionContext.getRequest();
		response = ServletActionContext.getResponse();
		session = request.getSession();
		application = ServletActionContext.getServletContext();
		
		
		
	}
//	//用于error.jsp传参
//		protected String errorsText;
//		protected static String backurl;
//		
//		public String getErrorsText() {
//			return errorsText;
//		}
//		public String getBackurl() {
//			return backurl;
//		}
//		
//		public void setErrorMessage(String msg){
//			this.errorsText = msg;
//		}
//		
//		public static void setBackUrl(String url){
//			backurl = url;
//		}
//		
//		public static void setBackUrl(HttpServletRequest request){
//			String s = request.getRequestURI();
//			int pos = s.indexOf("/", 1);
//			String url = s.substring(pos+1,s.length());
//			url += "?";
//			url += request.getQueryString();
//			
//			backurl = url;
//		}
}
